﻿Imports System.Windows.Forms

Public Class DialogComment
    Dim limit As Integer = 140
    Friend Shared cmt As String = String.Empty

    Public Overloads Function ShowDialog(ByVal CharLimit As Integer) As DialogResult
        limit = CharLimit
        Return MyBase.ShowDialog()
    End Function
    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        cmt = txtComment.Text
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        cmt = String.Empty
        Me.Close()
    End Sub

    Private Sub txtComment_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtComment.TextChanged
        lblCounter.Text = txtComment.Text.Length.ToString + "/" + limit.ToString
    End Sub

    Private Sub DialogComment_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        lblCounter.Text = txtComment.Text.Length.ToString + "/" + limit.ToString
    End Sub
End Class
